<template>
  <div >
  <van-swipe class="my-swipe"
             :autoplay="3000"
             indicator-color="white"
             style="height: 300px"

  >
    <van-swipe-item v-for="(item,index) in imglist" :key="index">
      <img :src="`${publicPath}${item.imgs}`" alt="">
    </van-swipe-item>

  </van-swipe>
  </div>
</template>

<script>
import Vue from 'vue';
import { Swipe, SwipeItem } from 'vant';
import 'vant/lib/index.css';
import http from "@/util/http";
Vue.use(Swipe);
Vue.use(SwipeItem);
export default {
  name: 'swiper',
  data() {
    return {
      publicPath:process.env.BASE_URL,
      imglist: []
    }
  },
  created() {
    http.get('/posts1',{
        params:{
          swiper:"1"
        }
    }).then(res =>{
      this.imglist = res.data

    })
  }
}
</script>

<style scoped lang="scss">
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 300px;
  text-align: center;
  background-color: #39a9ed;
}
img{
  width: 100%;
  height: 100%;
}



</style>
